// ConnSetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "FileSender.h"
#include "ConnSetDlg.h"
#include "afxdialogex.h"


// CConnSetDlg dialog

IMPLEMENT_DYNAMIC(CConnSetDlg, CDialogEx)

CConnSetDlg::CConnSetDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(CConnSetDlg::IDD, pParent)
	, bServer(FALSE)
	, dwIpAddr(0)
	, uiPort(0)
{

}

CConnSetDlg::~CConnSetDlg()
{
}

void CConnSetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Radio(pDX, IDC_CLIENT, bServer);
	DDX_IPAddress(pDX, IDC_IPADDRESS, dwIpAddr);
	DDX_Text(pDX, IDC_PORT, uiPort);
}


BEGIN_MESSAGE_MAP(CConnSetDlg, CDialogEx)
	ON_BN_CLICKED(IDC_SERVER, &CConnSetDlg::OnBnClickedServer)
	ON_BN_CLICKED(IDC_CLIENT, &CConnSetDlg::OnBnClickedClient)
END_MESSAGE_MAP()


// CConnSetDlg message handlers


void CConnSetDlg::OnBnClickedServer()
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_IPADDRESS)->EnableWindow(0);
}


void CConnSetDlg::OnBnClickedClient()
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_IPADDRESS)->EnableWindow(1);
}


BOOL CConnSetDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  Add extra initialization here
	if(bServer)
		GetDlgItem(IDC_IPADDRESS)->EnableWindow(0);
	((CStatic*)GetDlgItem(IDC_REMARKSICON))->SetIcon(LoadIcon(NULL, MAKEINTRESOURCE(IDI_ASTERISK)));

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
